using System;
using System.Collections.Generic;
using System.Text;
using AgilePlannerDT.Data;

namespace AgilePlannerDT.Persister
{
    /// <summary>
    /// 
    /// </summary>
    public interface AsynchronousPersister
    {

        #region Properties

        /// <summary>
        /// Gets the current project.
        /// </summary>
        /// <value>The project.</value>
        Project Project
        {
            get;
            set;
        }

        #endregion

        #region Connection

        /// <summary>
        /// Determines whether the persister is connected.
        /// </summary>
        /// <returns>
        /// 	<c>true</c> if this instance is connected; otherwise, <c>false</c>.
        /// </returns>
        bool IsConnected();

        /// <summary>
        /// Connects this instance.
        /// </summary>
        void Connect(string projectName);

        /// <summary>
        /// Disconnects this instance.
        /// </summary>
        /// <returns></returns>
        void Disconnect();

        /// <summary>
        /// Logs in the specified user.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        void Login(String userName, String password);

        #endregion

        #region Load

        /// <summary>
        /// Loads the specified project. Project should be created if it does not exist.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        void Load(String projectName);

        /// <summary>
        /// Loads the iterations from the specified project that are inside the give timeframe.
        /// Backend does not support this functionality yet.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        void Load(String projectName, DateTime start, DateTime end);

        /// <summary>
        /// Gets a list with the names of available projects.
        /// </summary>
        void GetProjectNames();

        #endregion

        #region Create

        /// <summary>
        /// Creates a backlog. Only one backlog is allowed per project. Attempts to
        /// create a second one will raise an exception.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="locationX">The location X.</param>
        /// <param name="locationY">The location Y.</param>
        void CreateBacklog(int width, int height, int locationX, int locationY);

        /// <summary>
        /// Creates an iteration and adds it to the current project.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="locationX">The location X.</param>
        /// <param name="locationY">The location Y.</param>
        /// <param name="availableEffort">The available effort.</param>
        /// <param name="startDate">The start date.</param>
        /// <param name="endDate">The end date.</param>
        void CreateIteration(String name, String description, int width, int height, int locationX, int locationY, float availableEffort,
                DateTime startDate, DateTime endDate);

        /// <summary>
        /// Creates a story card and adds it to the parent specified by parentid.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="locationX">The location X.</param>
        /// <param name="locationY">The location Y.</param>
        /// <param name="parentid">The parentid.</param>
        /// <param name="bestCaseEstimate">The best case estimate.</param>
        /// <param name="mostlikelyEstimate">The mostlikely estimate.</param>
        /// <param name="worstCaseEstimate">The worst case estimate.</param>
        /// <param name="actualEffort">The actual effort.</param>
        /// <param name="status">The status.</param>
        /// <param name="color">The color.</param>
        /// <param name="cardOwner">The card owner.</param>
        /// <param name="rotationAngle">The rotation angle.</param>
        void CreateStoryCard(String name, String description, int width, int height, int locationX, int locationY, long parentid,
                float bestCaseEstimate, float mostlikelyEstimate, float worstCaseEstimate, float actualEffort, String status, String color, String cardOwner, float rotationAngle);

        /// <summary>
        /// Creates a new project. New project becomes current project
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        void CreateProject(String projectName);

        #endregion

        #region Delete

        /// <summary>
        /// Deletes the backlog.
        /// </summary>
        /// <param name="id">The id.</param>
        void DeleteBacklog(long id);

        /// <summary>
        /// Deletes specified the iteration.
        /// </summary>
        /// <param name="id">The id.</param>
        void DeleteIteration(long id);

        /// <summary>
        /// Deletes the specified project.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        void DeleteProject(String projectName);

        /// <summary>
        /// Deletes the specified story card.
        /// </summary>
        /// <param name="id">The id.</param>
        void DeleteStoryCard(long id);        

        #endregion

        #region Undelete

        /// <summary>
        /// Undeletes the specified iteration.
        /// </summary>
        /// <param name="iteration">The iteration.</param>
        void UndeleteIteration(Iteration iteration);

        /// <summary>
        /// Undeletes the specified story card.
        /// </summary>
        /// <param name="storycard">The storycard.</param>
        void UndeleteStoryCard(StoryCard storycard);

        #endregion

        #region Move

        /// <summary>
        /// Moves the story card to a new parent.
        /// </summary>
        /// <param name="sc">The sc.</param>
        /// <param name="newparentid">The newparentid.</param>
        /// <param name="locationX">The location X.</param>
        /// <param name="locationY">The location Y.</param>
        /// <param name="rotationAngle">The rotation angle.</param>
        void MoveStoryCardToNewParent(StoryCard sc, long newparentid, int locationX, int locationY, float rotationAngle);

        #endregion

        #region Update

        /// <summary>
        /// Updates the backlog.
        /// </summary>
        /// <param name="backlog">The backlog.</param>
        void UpdateBacklog(Backlog backlog);

        /// <summary>
        /// Updates the iteration.
        /// </summary>
        /// <param name="iteration">The iteration.</param>
        void UpdateIteration(Iteration iteration);

        /// <summary>
        /// Updates the legend.
        /// </summary>
        /// <param name="legend">The legend.</param>
        void UpdateLegend(Legend legend);

        /// <summary>
        /// Updates the project. Backend does not support this functionality yet.
        /// </summary>
        /// <param name="project">The project.</param>
        void UpdateProject(Project project);

        /// <summary>
        /// Updates the story card.
        /// </summary>
        /// <param name="storycard">The storycard.</param>
        void UpdateStoryCard(StoryCard storycard);

        #endregion

        #region Callback Listeners

        /// <summary>
        /// Adds a callback listener.
        /// </summary>
        /// <param name="listener">The listener.</param>
        void AddPlannerDataChangeListener(PlannerDataChangeListener listener);

        /// <summary>
        /// Removes a callback listener.
        /// </summary>
        /// <param name="listener">The listener.</param>
        void RemovePlannerDataChangeListener(PlannerDataChangeListener listener);

        #endregion

        #region Project

        /// <summary>
        /// Arranges the index cards in a project.
        /// </summary>
        /// <param name="project">The project.</param>
        void ArrangeProject(Project project);

        #endregion

        void MouseMove(MouseMove move);

        void LiveUpdate(LiveUpdate update);

        void MinimizeCard(long cardID);

        #region jazz synchronization

        void SynchWithJazz(int MessageType, Dictionary<string,string> data);

        #endregion

        void AddTeamMember(TeamMember newMember);

        void RemoveTeamMember(TeamMember newMember);

        #region Dot Voting

        void StartVoting();
        void StopVoting();
        void VoteCard(VoteDot dot);
        void ClearVotes();

        #endregion

    }
}
